package com.civil.response;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


//注册拦截器
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
 
 

    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //                指定磁盘存放音乐的绝对路径，所有静态资源存放在music文件夹下
    	
    	String os = System.getProperty("os.name");

    	   if (os.toLowerCase().startsWith("win")) {  //如果是Windows系统
    		   registry.addResourceHandler("/img/**")
               .addResourceLocations("file:E:/soft_installed/img/");
    	   } else {  //linux 和mac
    	      registry.addResourceHandler("/img/**")
    	            .addResourceLocations("file:/home/img/");  //媒体资源
    	   }
    	
        
    }
}
